package com.beeweeb.services.tps;

import com.beeweeb.services.tps.util.BoundedArrayList;
import java.util.ArrayList;

/**
 * @author guido d'albore
 */
public class JobPool {
    BoundedArrayList<Class> classes;
    BoundedArrayList<Object> parameters;

    public JobPool() {
        this(Integer.MAX_VALUE);
    }

    protected JobPool(int jobPoolAcceptedCount) {
        int maxCapacity;
        
        if(jobPoolAcceptedCount > 0) {
            maxCapacity = jobPoolAcceptedCount;
        } else {
            maxCapacity = Integer.MAX_VALUE;
        }

        classes     = new BoundedArrayList<Class>(maxCapacity);
        parameters  = new BoundedArrayList<Object>(maxCapacity);
    }

    public void pushJob(Class clazz, Object parameter) {
        classes.add(clazz);
        parameters.add(parameter);
    }

    public ArrayList<Class> getClasses() {
        return classes;
    }

    public ArrayList<Object> getParameters() {
        return parameters;
    }
}
